var menus = {
	/* Left Menu */
	left: {
		fill:function(DatabaseList,TableList)
		{
			$('#divLeftMenuContent').empty();
			$.each(DatabaseList,function(i,db){
				$('#divLeftMenuContent').append(''+
					'<div class="divLeftMenuDB">'+
						'<a href="javascript:void(0);" onclick="menus.left.showTables(\'divLeftMenuTables_'+db+'\')">'+
							'<img src="images/butLeftDB.png" border="0" align="absmiddle">'+db+
						'</a>'+
						'<div id="divLeftMenuTables_'+db+'" class="divLeftMenuTables"></div>'+
					'</div>');

				$.each(TableList[db],function(z,tb){
					$('#divLeftMenuTables_'+db).append(''+
						'<div class="divLeftMenuTable">'+
							'<a href="javascript:void(0);" onclick="server.requests.getTableData(\''+db+'\',\''+tb+'\')">'+
								'<img src="images/butLeftTable.png" border="0" align="absmiddle">'+
							'</a>'+
							'[<a href="javascript:void(0);" onclick="">more</a>] '+
							'<a href="javascript:void(0);" onclick="">'+tb+'</a>'+
						'</div>');
				});
			});
		},

		menu:function()
		{
			if(!LEFTMENUOPEN)
			{
				menus.left.show();
			}
			else
			{
				menus.left.hide();
			}
		},
		
		show:function()
		{
			$('#divLeftMenu').animate({'left':'0px'},{duration: "slow"});
			LEFTMENUOPEN = true;
		},
		
		hide:function()
		{
			$('#divLeftMenu').animate({'left':'-230px'},{duration: "slow"});
			LEFTMENUOPEN = false;
		},

		showTables:function(id)
		{
			if($('#'+id).css('display') == 'none')
			{
				$('#'+id).show();
			}
			else
			{
				$('#'+id).hide();
			}
		}
	},

	top: {
		on:function(obj)
		{
			for(var img in obj.childNodes)
			{
				if('undefined' != typeof obj.childNodes[img].src)
				{
					obj.childNodes[img].className = 'imgTopMenuOn';
				}
			}
		},
	
		off:function(obj)
		{
			for(var img in obj.childNodes)
			{
				if('undefined' != typeof obj.childNodes[img].src)
				{
					obj.childNodes[img].className = 'imgTopMenuOff';
				}
			}
		}
	},

	tableData: {
		draw:function(){
			$('#divMainContent').append(''+
				'<table cellpadding="2" cellspacing="3" class="fontTahoma size8 colorBlack">'+
					'<tr>'+
						'<td height="24" class="borderGray">'+
							'<a href="javascript:void(0);">'+
								'<img src="images/butContentSaveResults.png" border="0" align="absmiddle">Save Results As'+
							'</a>'+
						'</td>'+
					'</tr>'+
				'</table>');
		}
	}
};